import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WhitelistDetailsVO, WhitelistDetailsForm, WhitelistDetailsQuery } from '@/api/busi/whitelistDetails/types';

/**
 * 查询白名单申报明细列表
 * @param query
 * @returns {*}
 */

export const listWhitelistDetails = (query?: WhitelistDetailsQuery): AxiosPromise<WhitelistDetailsVO[]> => {
  return request({
    url: '/busi/whitelistDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询白名单申报明细详细
 * @param id
 */
export const getWhitelistDetails = (id: string | number): AxiosPromise<WhitelistDetailsVO> => {
  return request({
    url: '/busi/whitelistDetails/' + id,
    method: 'get'
  });
};

/**
 * 新增白名单申报明细
 * @param data
 */
export const addWhitelistDetails = (data: WhitelistDetailsForm) => {
  return request({
    url: '/busi/whitelistDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改白名单申报明细
 * @param data
 */
export const updateWhitelistDetails = (data: WhitelistDetailsForm) => {
  return request({
    url: '/busi/whitelistDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除白名单申报明细
 * @param id
 */
export const delWhitelistDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/busi/whitelistDetails/' + id,
    method: 'delete'
  });
};
